﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsUserControl.UIUpdateWrapper
{
    /// <summary></summary>
    public class ButtonUpdator
    {
        private Button _Button;
        private string _Text;
        private bool _Enabled;
        private Color _BackColor;

        /// <summary></summary>
        public ButtonUpdator(Button btn, Color bkColor, bool enabled, string txt)
        {
            this._Button = btn;
            this._BackColor = bkColor;
            this._Enabled = enabled;
            this._Text = txt;
            this._Button.Invoke(new MethodInvoker(this.UpdateButton));
        }

        private void UpdateButton()
        {
            this._Button.BackColor = this._BackColor;
            this._Button.Enabled = this._Enabled;
            this._Button.Text = this._Text;
        }
    }
}
